[QUIZ] Test your understanding of SQL - Part 6
- Question 1: Which SQL statement would you use to select all columns from the THONGTIN_SACH table below?THONGTIN_SACH Table:
Ten_cot ID_SACH TEN_SACH GIA
* Table used for questions from 1 to 10.- SELECT ID_SACH + GIA FROM THONGTIN_SACH;
- SELECT * FROM THONGTIN_SACH;
- SELECT ALL FROM THONGTIN_SACH;
- SELECT ALL COLUMNS FROM THONGTIN_SACH;
-
Question 2: Which SQL statement is used to select all books with prices higher than 200000?- SELECT ID_SACH FROM THONGTIN_SACH HAVING GIA> 200000;
- SELECT ID_SACH FROM THONGTIN_SACH ONLY GIA> 200000;
- SELECT ID_SACH FROM THONGTIN_SACH WHERE ID_SACH> 200000;
- SELECT ID_SACH FROM THONGTIN_SACH WHERE GIA> 200000;
-
- Question 3: Which SQL statement is used to select all books whose title starts with 'A'?
- SELECT ID_SACH, TEN_SACH FROM THONGTIN_SACH WHERE TEN_SACH LIKE 'A';
- SELECT ID_SACH, TEN_SACH FROM THONGTIN_SACH WHERE TEN_SACH IN 'A';
- SELECT ID_SACH, TEN_SACH FROM THONGTIN_SACH WHERE TEN_SACH LIKE 'A%';
- SELECT ID_SACH, TEN_SACH FROM THONGTIN_SACH WHERE TEN_SACH LIKE '% A';
-
- Question 4: Which SQL statements allow sorting all books by high to low prices?
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH ORDER BY GIA DESC;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH SORT BY GIA DESC;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH SORT BY GIA ASC;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH ORDER BY GIA ASC;
-
- Question 5: Which SQL statement allows inserting the following data segment into THONGTIN_SACH?
ID_SACH = 20
TEN_SACH = 'HOC SQL TU QUANTRIMANG.COM'
GIA = 150000- ADD INTO THONGTIN_SACH WITH (20, 'HOC SQL TU QUANTRIMANG.COM', 150000);
- INSERT INTO THONGTIN_SACH USING (20, 'HOC SQL TU QUANTRIMANG.COM', 150000);
- INSERT INTO THONGTIN_SACH VALUES (20, 'HOC SQL TU QUANTRIMANG.COM', 150000);
- ADD INTO THINKSNESS VALUES (20, 'HOC SQL TU QUANTRIMANG.COM', 150000);
-
- Question 6: Which SQL statement allows to delete the THONGTIN_SACH table from the database?
- DROP THONGTIN_SACH;
- DELETE TABLE THONGTIN_SACH;
- TRUNCATE TABLE THONGTIN_SACH;
- DROP TABLE THONGTIN_SACH;
-
- Question 7: Which SQL statement is used to delete rows with ID_SACH = 15?
- TRUNCATE TABLE THONGTIN_SACH WHERE ID_SACH = 15;
- DELETE FROM THONGTIN_SACH WHERE ID_SACH = 15;
- DROP THONGTIN_SACH WHERE ID_SACH = 15;
- TRUNCATE THONGTIN_SACH WHERE ID_SACH = 15;
-
- Question 8: Which SQL statement used to change prices for SACH titled 'HOC SQL TU QUANTRIMANG.COM' to 200000?
- UPDATE THONGTIN_SACH SET GIA = 200000 WHERE TEN_SACH = 'HOC SQL TU QUANTRIMANG.COM';
- UPDATE TABLE THONGTIN_SACH SET GIA = 200000 WHERE TEN_SACH = 'HOC SQL TU QUANTRIMANG.COM';
- UPDATE THONGTIN_SACH CHANGE GIA = 200000 WHERE TEN_SACH = 'HOC SQL TU QUANTRIMANG.COM';
- UPDATE TABLE THONGTIN_SACH SET GIA = 200000 WHERE ID_SACH = 'HOC SQL TU QUANTRIMANG.COM';
-
- Question 9: Which SQL statement allows to find the highest price from the table THONGTIN_SACH?
- SELECT ID_SACH, TEN_SACH, MAX (GIA) FROM THONGTIN_SACH;
- SELECT MAX (GIA) FROM THONGTIN_SACH;
- SELECT MAXIMUM (GIA) FROM THONGTIN_SACH;
- SELECT GIA FROM THONGTIN_SACH ORDER BY GIA DESC;
-
- Question 10: Which SQL statement allows to find all books priced from 150000 to 200000?
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH WHERE GIA IS BETWEEN 150000 AND 200000;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH HAVING GIA IS BETWEEN 150000 AND 200000;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH WHEN GIA BETWEEN 150000 AND 200000;
- SELECT ID_SACH, TEN_SACH, GIA FROM THONGTIN_SACH HAVING GIA BETWEEN 150000 AND 200000;
-
- Question 11: Following the table below, which SQL statement will find the sales amount of each store?Table BANHANG:
Ten_cot ID_CUAHANG NGAY_BAN BUSINESS_THU
* Table used for questions 11 to 15.- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG;
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG ORDER BY ID_CUAHANG;
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG GROUP BY ID_CUAHANG;
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG HAVING UNIQUE ID_CUAHANG;
-
- Question 12: Which SQL statement allows you to list all stores with total sales over 5000?
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG GROUP BY ID_CUAHANG HAVING SUM (JOINT_THU)> 5000;
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG GROUP BY ID_CUAHANG HAVING JOINT_THU> 5000;
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG WHERE SUM (BUSINESS_THU)> 5000 GROUP BY ID_CUAHANG;
- SELECT ID_CUAHANG, SUM (BUSINESS_THU) FROM BANHANG WHERE JOINT_THU> 5000 GROUP BY ID_CUAHANG;
-
- Question 13: Which SQL statement is used to find the earliest date that store ID = 10 has revenue greater than 0?
- SELECT MAX (NGAY_BAN) FROM BANHANG WHERE ID_CUAHANG = 10 AND JOINT_THU> 0;
- SELECT NGAY_BAN FROM BANHANG WHERE ID_CUAHANG = 10 AND JOINT_THU> 0;
- SELECT MIN (NGAY_BAN) FROM BANHANG WHERE ID_CUAHANG = 10 OR JOINT_THU> 0;
- SELECT MIN (NGAY_BAN) FROM BANHANG WHERE ID_CUAHANG = 10 AND JOINT_THU> 0;
-
- Question 14: Which SQL statement allows to find the total number of stores in the BANHANG table?
- SELECT COUNT (ID_CUAHANG) FROM BANHANG;
- SELECT COUNT (DISTINCT ID_CUAHANG) FROM BANHANG;
- SELECT DISTINCT ID_CUAHANG FROM BANHANG;
- SELECT COUNT (ID_CUAHANG) FROM BANHANG GROUP BY ID_CUAHANG;
-
- Question 15: Which SQL statement allows you to find the total number of store sales with ID is 25 and the store has an ID of 45?
- SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG WHERE ID_CUAHANG IN (25.45) GROUP BY ID_CUAHANG;
- b) SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG GROUP BY ID_CUAHANG HAVING ID_CUAHANG IN (25.45);
- c) SELECT ID_CUAHANG, SUM (Doanh_THU) FROM BANHANG WHERE ID_CUAHANG IN (25.45);
- d) SELECT ID_CUAHANG, SUM (BUSINESS_THU) FROM BANHANG WHERE ID_CUAHANG = 25 AND ID_CUAHANG = 45 GROUP BY ID_CUAHANG;
-
5 ★ | 1 Vote
You should read it
- [QUIZ] Test your understanding of SQL - Part 5
- [QUIZ] Test your understanding of SQL - Part 1
- [QUIZ] Test your understanding of SQL - Part 7
- [QUIZ] Check your understanding of SQL - Part 2
- Test about database security P8
- What do you know about NoSQL Database?
- eQuiz - Multiple choice test on SQL
- Test about database security P12
May be interested
- Multiple choice quiz about Python - Part 10following the previous test, part 10 returned with the python function. let's try with quantrimang to try the 10 questions below.
- eQuiz - Quiz on Core Java - Part 1in the quiz below, you will be able to challenge the most basic questions related to core java - one of the most popular programming languages today.
- Excel computer test - Part 3after the second part of the excel test, the network administrator will continue to send you the 3rd part of the quiz series on this topic. let's work together to test your knowledge.
- eQuiz - Multiple choice test on PHP Practice - part 1in the quiz below, we will introduce you to part 1 of the test series of basic knowledge about php practive with 15 questions.
- Test your level of understanding of Office 2010 - Part 1in the article below, the network administrator will send you to read interesting quiz questions about office so you can assess your level of understanding about this software.
- eQuiz - Multiple choice test on programming language C - part 1this is part 1 of a series of tests on knowledge of c programming language, in total there will be 15 questions with no time for answering each sentence.
- The test has a Word answer - Part 7below is part 7 of the word quiz series. hopefully, these quizzes will help you partially test your knowledge for a long time.
- Multiple choice quiz about Python - Part 7following the previous test set, part 7 continues with the topic built-in functions in python. let's try with quantrimang to try the 10 questions below.
- Multiple choice quiz about Python - Part 5if you are interested in learning about the python programming language, the following quiz of network administrator will provide useful knowledge for your learning.
- Testing computer science knowledge, doing little for fun (part 2)the series of computer science quiz questions covers many areas with a set of 4 answers and answers at the bottom of the page. after part 1, network administrator continues to introduce part 2.